Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add terraform for capz monitoring cluster #7776

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

willie-yao
Copy link
Contributor

Adds terraform needed to recreate the capz monitoring cluster used to monitor/export metrics from CAPZ e2e tests.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Feb 10, 2025
@k8s-ci-robot k8s-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. area/infra Infrastructure management, infrastructure design, code in infra/ area/infra/azure Issues or PRs related to Kubernetes Azure infrastructure area/provider/azure Issues or PRs related to azure provider sig/cluster-lifecycle Categorizes an issue or PR as relevant to SIG Cluster Lifecycle. sig/k8s-infra Categorizes an issue or PR as relevant to SIG K8s Infra. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Feb 10, 2025
@willie-yao
Copy link
Contributor Author

/hold for reviews
/cc @jsturtevant @nojnhuh @ritikaguptams @mboersma

My first go with terraform stuff. I just modeled the file off of my existing capz-monitoring cluster. Is it okay to hard-code the name and location since I don't think it's currently set to the default? If not, I can re-create the cluster in the correct location

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Feb 10, 2025
Copy link
Contributor

@mboersma mboersma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

Is it okay to hard-code the name and location

I'm not sure actually, I followed the var.location convention when I made changes, but I'm not a terraform expert. I doubt it's a problem in practice to use eastus, but maybe @jsturtevant knows?

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 12, 2025
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mboersma, willie-yao

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot
Copy link
Contributor

New changes are detected. LGTM label has been removed.

@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Mar 4, 2025
}
}

resource "azurerm_resource_group" "MC_capz-monitoring_capz-monitoring_eastus" {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am surprised that this resource group needs to be captured in the terraform. This is a RG that is managed by AKS and shouldn't be managed by terraform AFAIK.

https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/kubernetes_cluster#node_resource_group-1

Says confirms that for me, in that we could provide a name but otherwise don't need to specify it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah that makes sense. I included it because I noticed that this resource group has been getting deleted on the CNCF sub periodically while I'm testing even though I have the do not delete tag set on it. Does this need to be in terraform if I don't want it to be deleted, or is that being caused by something else?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe that if you put the tags do-not-delete on the AKS resource group and AKS cluster, it will carry those through when it creates managed RG.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm okay, next time it gets deleted I might need some help figuring out what is causing it. Thanks!

@jsturtevant
Copy link
Contributor

jsturtevant commented Mar 5, 2025

My first go with terraform stuff. I just modeled the file off of my existing capz-monitoring cluster. Is it okay to hard-code the name and location since I don't think it's currently set to the default? If not, I can re-create the cluster in the correct location

I think you've done the right thing with the location/name. Those are variables, you can specify them with variables to use them with pre-created clusters. The part you don't need is the node_resource_group which shouldn't be managed by Terraform, if I understand the docs correct: https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/kubernetes_cluster#example-usage

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/infra/azure Issues or PRs related to Kubernetes Azure infrastructure area/infra Infrastructure management, infrastructure design, code in infra/ area/provider/azure Issues or PRs related to azure provider cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. sig/cluster-lifecycle Categorizes an issue or PR as relevant to SIG Cluster Lifecycle. sig/k8s-infra Categorizes an issue or PR as relevant to SIG K8s Infra. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants